#ifndef PARSER_H
#define PARSER_H

#include <QString>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QRegExp>
#include <QObject>
#include <QMap>

class Parser : public QObject
{
    Q_OBJECT

public:
    Parser();

    void setUrl(QUrl url);
    void getPage();
    QNetworkReply *getReply();
    QMap <QString, int> getCount();

private:
    QString page;
    QNetworkAccessManager manager;
    QNetworkRequest request;
    QNetworkReply* reply;
    QMap <QString, QRegExp> regexp;
    QMap <QString, int> count;

signals:
    void countFinished();

private slots:    
    void read();
    void parse();
};

#endif // PARSER_H
